<link href="./css/style.css" rel="stylesheet" type="text/css" />
<link href="./css/DateTimePicker.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" charset="utf-8" src="/inc/Editer/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/inc/Editer/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="/inc/Editer/lang/zh-cn/zh-cn.js"></script>
<script src="./js/jquery.js"></script>
<script src="./js/DateTimePicker.js"></script>
<script src="/skin/js/vue.js"></script>
<div class="main" style="height:auto;">
<div class="info">
	<p class="tt"><a>首页</a>><a href="agentlist.php">区域代理</a>><span>代理编辑</span></p>	
	<form class="goodadd">
		<div id='tab1' class='hide'>
			<input type="hidden" name="id" value="{$ginfo[Id]}" >
			<p class="p1"><span>代理账户</span>{$ginfo[uname]}[{$ginfo[tname]}]</p>
			<p class="p3"><span>代理区域</span>
				<select name="pro" id="pro">
					{$ginfo[pro]}
				</select>
				<select name="cit" id="cit" {if(!$ginfo['cit'])} style="display:none;" {/if}>
					{$ginfo[cit]}
				</select>
				<select name="cou" id="cou" {if(!$ginfo['cou'])} style="display:none;" {/if}>
					{$ginfo[cou]}
				</select>
			</p>
			<button type="button" class="tj">确认修改</button>
		</div>			
	</form>	
	
	<script>
		$("#pro").change(function(){
		var id = $(this).val();
		$("#cit,#cou").html("");
		$("#cit,#cou").hide();
		if(id>0){
			$.ajax({
				type:"post",
				dataType:"json",
				url:"/Moudel.php?m=m&a=getcit",
				data:"id="+id,
				success:function(d){
					if(d[0]==0){
						alert(d[1]);
					}
					else{
						$("#cit").show();
						$("#cit").html(d[1]);
					}
				}
			});
		}
	});
	$("#cit").change(function(){
		var id = $(this).val();
		$("#cou").html("");
		$("#cou").hide();
		if(id>0){
			$.ajax({
				type:"post",
				dataType:"json",
				url:"/Moudel.php?m=m&a=getcou",
				data:"id="+id,
				success:function(d){
					if(d[0]==0){
						alert(d[1]);
					}
					else{
						$("#cou").show();
						$("#cou").html(d[1]);
					}
				}
			});
		}
	});
		$(".tj").on("click",function(){
			var msg = confirm("确认修改当前代理信息？");
			if(msg==true){
				$.ajax({
					type:"post",
					dataType:"json",
					url:"/Moudel.php?m=m&a=agentedit",
					data:$(".goodadd").serialize(),
					success:function(d){
						if(d[0]==0){
							alert(d[1]);
						}
						else{
							alert(d[1]);
							window.location.href='agentlist.php';
						}
					}
				});
			}			
		});

	</script>
	
</div>
</div>